package com.headwind.multi.datasource;

import com.headwind.multi.datasource.holder.DynamicDataSourceHolder;
import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource;

/**
 * @author : Headwind
 * @version : 1.0
 * @date : Created in 2020/8/13
 * @description : 当前数据源取得类
 */
public class DynamicDataSource extends AbstractRoutingDataSource {

    /**
     * 当前数据源获取
     */
    @Override
    protected Object determineCurrentLookupKey() {
        return DynamicDataSourceHolder.getDataSource();
    }
}
